---
layout: "default"
title: "dropLast"
description: "Swift documentation for 'dropLast': Return a slice containing all but the last element of s."
keywords: "dropLast,func,swift,documentation"
root: "/v1.2"
---

<div class="declaration" id="func-droplast-s_-sliceable-where-s-index_-bidirectionalindextype_-s">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-droplast-s_-sliceable-where-s-index_-bidirectionalindextype_-s">func <wbr>dropLast&lt;S :<wbr> Sliceable where S.Index : BidirectionalIndexType&gt;(<wbr>_: S)</a>
        
<div class="comment collapse" id="comment-func-droplast-s_-sliceable-where-s-index_-bidirectionalindextype_-s"><div class="p">
    <p>Return a slice containing all but the last element of <code>s</code>.</p>

<p>Requires: <code>s</code> is non-empty.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func dropLast&lt;S : Sliceable where S.Index : BidirectionalIndexType&gt;(s: S) -&gt; S.SubSlice</code>
    
    
</div></div>
</div>
